//
//  LBGoodsTableViewCell.m
//  LvoeBeen_Imitation
//
//  Created by Mac on 17/2/19.
//  Copyright © 2017年 itcast. All rights reserved.
//

#import "LBGoodsTableViewCell.h"
#import "LBSuperMarketGoodModel.h"

@interface LBGoodsTableViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *iconView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *specificsLabel;
@property (weak, nonatomic) IBOutlet UILabel *partner_priceLabel;
@property (weak, nonatomic) IBOutlet UILabel *market_priceLabel;
@property (weak, nonatomic) IBOutlet UIImageView *had_pmImageView;

@end

@implementation LBGoodsTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
}

- (IBAction)clickIncreasePrduct:(UIButton *)sender {
    if ([_delegate respondsToSelector:@selector(addGoodsToShoppingTrolly:imageView:)]) {
        [_delegate addGoodsToShoppingTrolly:self imageView:_iconView];
    }
}

- (void)setModel:(LBSuperMarketGoodModel *)model {
    _model = model;
    
    [_iconView yy_setImageWithURL:[NSURL URLWithString:model.img] options:0];
    _nameLabel.text = model.name;
    _nameLabel.preferredMaxLayoutWidth = 150;
    _specificsLabel.text = model.specifics;
    _partner_priceLabel.text = [NSString stringWithFormat:@"$%@",model.partner_price];
    _market_priceLabel.text = [NSString stringWithFormat:@"$%@",model.market_price];
    _had_pmImageView.hidden = !model.had_pm;
}

@end
